<include file="../header" />
</head>
<body class="J_scroll_fixed">
<script type="text/javascript">
    function processPage(id, page, name) {
        if(!confirm("是否加载 【"+name+"】 页面？")){
            return false;
        }else {
            var url = "/admin/workorder/process?id=" + id + "&page=" + page + "&home=1";
            window.location.href = url;
        }

    }

    $(function() {
        $("#process"+"{$page}").attr("class", "img-process-select");

        $("input[name=completed]").click(function() {
            if($("input[name=completed]").is(':checked')) {
                $("button.btn_submit").text("完成");
            }else{
                $("button.btn_submit").text("更新");
            }
        });

        $("button.btn_submit").click(function() {
            if($("input[name=completed]").is(':checked')) {
                if (confirm("勾选'完成'后提交表单将无法再次修改，是否继续提交")) {
                    $("button.btn_submit").hide();
                } else {
                    return false;
                }
            }else{
                $("button.btn_submit").hide();
            }
        });
        $("select[name='proecessPage']").change(function () {
            var id = "{$workorder.workorder_id}";
            var page = $("select[name='proecessPage']").val();
            if(!confirm("是否加载["+$("select[name='proecessPage']").find("option:selected").text()+"]页面？")){
                return false;
            }else {
                var url = "/admin/workorder/process?id=" + id + "&page=" + page + "&home={$home}";
                window.location.href = url;
            }
        });

//        $("button.btn_submit").click(function() {
//
//            if($("input[name=completed]").is(':checked')) {
//                if (!confirm("勾选'完成'后提交处方单将无法再次修改，是否继续提交？")) {
//                    return false;
//                }else{
////                    $("form").submit();
//                }
//            }
//        });
        if(parseInt('{$pageStatus}') == 1){
            $("button.btn_submit").attr("disabled","disabled");
            $("button.btn_submit").text("已完成");
        }
    });

</script>
<style type="text/css">
    .img-process{
        width: 70px;
        height: 70px;
        cursor: pointer;
    }
    .img-process-select{
        width: 70px;
        height: 70px;
        cursor: pointer;
        border: solid;
        border-color: #1ABC9B;
    }
</style>
<form class="well form-search"  style="float:left;width:100%;margin-bottom: -20px" >
    <php>$imgVersion = "2020051401";</php>
    <div class="search_type cc mb10">
        <div >
            <span class="mr20">
                单号：<input type="text" value="{$workorder.workorder_no}" readonly/>&nbsp;
                患者：<input type="text" value="{$patient.patient_name}，{$patient.sex}，{$patient.age}岁 {$workorder.side}" readonly/>&nbsp;
                业务员：<input type="text" value="{$sales.admin_name}" readonly/>&nbsp;
                处方人：<input type="text" value="{$prescriber.admin_name}" readonly/>
            </span>
        </div>
        <br/>
        <php>
            $processStatusArr=explode(",",$workorder["process_status"]);
            if(in_array($workorder["workorder_type"],array('1','5','6','7')))
            $processArr = array("取阴模", "检查取阴模","修阳模","检查修阳模","热塑成型","检查热塑成型","打磨抛光","检查打磨抛光","组装对线","半成品适配","穿戴及使用训练","入库");
            if(in_array($workorder["workorder_type"],array('2','4')))
            $processArr = array("取阴模2", "检查取阴模2","修阳模2","检查修阳模2","热塑成型","检查热塑成型","打磨抛光","检查打磨抛光","组装对线","半成品适配2","穿戴及使用训练2","入库");
            for($i = 0; $i < 12; $i++){
            if($processStatusArr[$i] == "1"){
            $processArr[$i] .= "亮";
            }
            }
        </php>
        <td>
            工序：
            <if condition="$orthosisProcess[0] eq '1'">
                <img class="img-process" id="process1" src="/Template/images/{$processArr.0}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",1,"取阴模")' title="取阴模"/>
            </if>
            <if condition="$orthosisProcess[1] eq '1'">
                <img class="img-process" id="process2" src="/Template/images/{$processArr.1}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",2,"检查取阴模")' title="检查取阴模"/>
            </if>
            <if condition="$orthosisProcess[2] eq '1'">
                <img class="img-process" id="process3" src="/Template/images/{$processArr.2}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",3,"修阳模")' title="修阳模"/>
            </if>
            <if condition="$orthosisProcess[3] eq '1'">
                <img class="img-process" id="process4" src="/Template/images/{$processArr.3}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",4,"检查修阳模")' title="检查修阳模"/>
            </if>
            <if condition="$orthosisProcess[4] eq '1'">
                <img class="img-process" id="process5" src="/Template/images/{$processArr.4}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",5,"热塑成型")' title="热塑成型"/>
            </if>
            <if condition="$orthosisProcess[5] eq '1'">
                <img class="img-process" id="process6" src="/Template/images/{$processArr.5}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",6,"检查热塑成型")' title="检查热塑成型"/>
            </if>
            <if condition="$orthosisProcess[6] eq '1'">
                <img class="img-process" id="process7" src="/Template/images/{$processArr.6}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",7,"打磨抛光")' title="打磨抛光"/>
            </if>
            <if condition="$orthosisProcess[7] eq '1'">
                <img class="img-process" id="process8" src="/Template/images/{$processArr.7}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",8,"检查打磨抛光")' title="检查打磨抛光"/>
            </if>
            <if condition="$orthosisProcess[8] eq '1'">
                <img class="img-process" id="process9" src="/Template/images/{$processArr.8}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",9,"组装对线")' title="组装对线"/>
            </if>
            <if condition="$orthosisProcess[9] eq '1'">
                <img class="img-process" id="process10" src="/Template/images/{$processArr.9}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",10,"半成品适配")' title="半成品适配"/>
            </if>
            <if condition="$orthosisProcess[10] eq '1'">
                <img class="img-process" id="process11" src="/Template/images/{$processArr.10}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",11,"穿戴及使用训练")' title="穿戴及使用训练"/>
            </if>
            <if condition="$orthosisProcess[11] eq '1'">
                <img class="img-process" id="process12" src="/Template/images/{$processArr.11}.png?v={$imgVersion}" onclick='javascript:processPage("{$workorder.workorder_id}",12,"入库")' title="入库"/>
            </if>
        </td>
    </div>
</form>
<div class="wrap jj">
    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('Workorder/process_post')}" onkeydown="if(event.keyCode==13)return false;" >
            <input type="hidden" name="workorderId" value="{$workorderId}" />
            <fieldset>
                <!--hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" >当前批记录：</label>
                    <select name="proecessPage">
                        <option value="{$process.status}"></option>
                        {:getFormDictSelectOptionHtml($page,'process_page','process',0)}
                    </select>
                </div>
                <hr class="half-rule">

                <div class="control-group">
                    <label class="control-label"></label>
                    <div class="controls" style="font-weight: bold; font-size: larger">
                        修阳模工序检查结果：{$patient.patient_name} {$workorder.side}
                    </div>
                </div-->
                <hr class="half-rule">
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th style="font-weight:bold;text-align: center;width: 25%">检测项目</th>
                        <th style="font-weight:bold;text-align: center;width: 25%">标准要求</th>
                        <th style="font-weight:bold;text-align: center;width: 5%">实测值</th>
                        <th style="font-weight:bold;text-align: center;width: 5%">理论公差</th>
                        <th style="font-weight:bold;text-align: center;width: 5%">实际公差</th>
                        <th style="font-weight:bold;text-align: center;width: 5%">检验工具</th>
                        <th style="font-weight:bold;text-align: center;width: 25%">检测结果</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td style="text-align: center;">阳模表面是否光滑，有无异常凸凹，有无无明显棱角，整体曲线是否圆润</td>
                        <td style="text-align: center;">阳模表面光滑，无异常凸凹，无明显棱角，整体曲线圆润</td>
                        <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p38" value="{$process.p38}"></td>
                        <td style="text-align: center;">---</td>
                        <td style="text-align: center;">---</td>
                        <td style="text-align: center;">目视</td>
                        <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p39" value="{$process.p39}"></td>
                    </tr>
                    <if condition="$workorder.workorder_type eq '1'">
                        <tr>
                            <td style="text-align: center;">跖趾关节宽度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p42" value="{$process.p42}"></td>
                            <td style="text-align: center;">±1mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p43" value="{$process.p43}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p44" value="{$process.p44}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center;">脚长</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p51" value="{$process.p51}"></td>
                            <td style="text-align: center;">±3mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p52" value="{$process.p52}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p53" value="{$process.p53}"></td>
                        </tr>
                    </if>
                    <if condition="$workorder.workorder_type eq '2' || $workorder.workorder_type eq '4'">
                        <tr>
                            <td style="text-align: center;">髂腰水平宽度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p40" value="{$process.p40}"></td>
                            <td style="text-align: center;">±3mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p41" value="{$process.p41}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p42" value="{$process.p42}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center;">髂腰前后宽度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p43" value="{$process.p43}"></td>
                            <td style="text-align: center;">±3mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p44" value="{$process.p44}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p45" value="{$process.p45}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center;">腋下水平宽度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p46" value="{$process.p46}"></td>
                            <td style="text-align: center;">±3mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p47" value="{$process.p47}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p48" value="{$process.p48}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center;">腋下到髂前上棘高度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p49" value="{$process.p49}"></td>
                            <td style="text-align: center;">±3mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p50" value="{$process.p50}"></td>
                            <td style="text-align: center;">卡尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p51" value="{$process.p51}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center;">支具高度</td>
                            <td style="text-align: center;">---</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p52" value="{$process.p52}"></td>
                            <td style="text-align: center;">±5mm</td>
                            <td><input type="text" class="input" style="text-align: center;width: auto; height: 10px" name="p53" value="{$process.p53}"></td>
                            <td style="text-align: center;">直尺</td>
                            <td><input type="text" class="input" style="text-align: center;width: 95%; height: 10px" name="p54" value="{$process.p54}"></td>
                        </tr>
                    </if>
                    </tbody>
                </table>
                <hr class="half-rule">
                <div class="control-group">
                    <label class="control-label" >检查结果:</label>
                    <div class="controls">
                        <input type="text" class="input" style="width: 600px" name="p60" value="{$process.p60}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">填表人:</label>
                    <div class="controls">
                        <img style="height: 50px" src="{$process.p61}">
                    </div>
                </div>
                
                <hr class="half-rule">
                <div class="control-group">
                    <div class="controls">
                        <label class="checkbox inline" style="font-weight: bold">
                            <input type="checkbox"  name="completed">完成（勾选后提交流程将无法再次修改）
                        </label>
                    </div>
                </div>

            </fieldset>
            <div class="form-actions">
                <input type="hidden" name="processId" value="{$processId}" />
                <input type="hidden" name="home" value="{$home}" />
                <input type="hidden" name="id" value="{$id}" />
                <input type="hidden" name="pageId" value="4" />
                <button type="submit" class="btn btn-primary btn_submit ">更新</button>
                <if condition="$adminUpdate eq 'true'">
                    <button type="submit" class="btn btn-danger">管理员更新</button>
                </if>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>